// Copyright (c) 2025, 大连理工大学 (Dalian University of Technology)
//
// Licensed under the Mulan PSL v2.
// You can use this file according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of the License at
//
//     http://license.coscl.org.cn/MulanPSL2
//
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE THE MULAN PSL v2
// FOR MORE DETAILS.

/**
 * @brief    DTI Parser
 *
 * @version  0.1
 * @author   wuxingchuang
 * @date     2025.06.23
 * @copyright Copyright (c) 2025
 */

#include "Import/BDFImport/BulkData/Dynamic/DTIParser.h"

#include <algorithm>
#include <cstdint>
#include <iostream>

#include "boost/algorithm/string.hpp"

#include "Utility/Logging/SGLogger.h"

#include "DBManager/DBServiceFactory.h"
#include "DBManager/IService/Input/Dynamic/ISPECSELService.h"

#include "Import/BDFImport/BDFParserBase.h"

BULKDATA_ENTRY_PARSER_REG (DTI);

using namespace SG::DBManager;
using namespace SG::Import;
using namespace SG::DataStructure;

enum SPECSELKey
{
    SPECSELKEY_DTI     = 1,
    SPECSELKEY_subMoudle = 2,
};

SG::DataStructure::Common::Status BDF::BULKDATA::ParseDTI (const std::shared_ptr<SG::DBManager::DBServiceFactory>& dbServiceFactory,
                                                           std::vector<std::string>&                               dividedEntryInfo)
{
    std::string curStrKey = dividedEntryInfo[1];
    boost::algorithm::trim (curStrKey);
    // 从BulkData工厂获取解析函数
    auto pNEParse = BDF::BulkDataEntryParserFactory::GetInstance ()->GetFunction (curStrKey);

    if(!pNEParse)
        return SG::DataStructure::Common::Status::STATUS_Failure;
    
    return pNEParse(dbServiceFactory,dividedEntryInfo);
}